package controller

import (
	"beergo/app/admin/models"
	"beergo/app/sys/elog"
	"beergo/lib/base/controller"
	"beergo/lib/tool"
	"github.com/beego/beego/v2/server/web"
)

type AdminBaseController struct {
	controller.ContainerController
}

func (this *AdminBaseController) GetUser() models.AdminUser{
	tokenKey := web.AppConfig.DefaultString("beer::AuthTokenAdmin","")
	xt := this.Ctx.Request.Header.Get(tokenKey)
	repUser := models.AdminUserRepository{}
	println(xt)
	elog.Info(xt)
	user := repUser.FindOneBy(tool.StringKeyMap{"token": xt}, nil)
	return user
}